home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
tutor
/
c1tutor.exe
/
STRUCT2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-07-04
|
678b
|
29 lines
/* Chapter 11 - Program 2 */
main()
{
struct {
char initial;
int age;
int grade;
} kids[12];
int index;
for (index = 0;index < 12;index++) {
kids[index].initial = 'A' + index;
kids[index].age = 16;
kids[index].grade = 84;
}
kids[3].age = kids[5].age = 17;
kids[2].grade = kids[6].grade = 92;
kids[4].grade = 57;
kids[10] = kids[4]; /* Structure assignment */
for (index = 0;index < 12;index++)
printf("%c is %d years old and got a grade of %d\n",
kids[index].initial, kids[index].age,
kids[index].grade);
}